var t = setTimeout(time(), 1000);//開始运行
function time() {
	clearTimeout(t);//清除定时器
	dt = new Date();
	var y = dt.getFullYear();
	var mt = dt.getMonth() + 1;
	var day = dt.getDate();
	var h = dt.getHours();//获取时
	var m = dt.getMinutes();//获取分
	var s = dt.getSeconds();//获取秒
	var wDay = dt.getDay();
	
	//不足两位补0
	mt = getDoubleNum(mt);
	day = getDoubleNum(day);
	h = getDoubleNum(h);
	m = getDoubleNum(m);
	s = getDoubleNum(s);
	
	document.querySelector(".showTime").innerHTML = '' + y + "/" + mt + "/" + day + " " + getWeekDate(wDay) + " " + h + ":" + m + ":" + s + "";
	 t = setTimeout(time, 1000); //设定定时器，循环运行     
}

function getWeekDate(wDay) {
   var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
   var week = weeks[wDay];
   return week;
}

function getDoubleNum(num) {
	if(num<10) {
		return "0" + num;
	}
	return num;
}